#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<complex>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
typedef complex<double> cp;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=3e5+10;
const db PI=acos(-1);
int n,m;
cp x[MAXN],y[MAXN];
void rader(int n,cp *x)
{
	for(int i=0,j=0;i<n;++i)
	{
		if(i<j)swap(x[i],x[j]);
		int k=n>>1;
		while((j^=k)<k)k>>=1;
	}
	return;
}
void FFT(int n,cp *x,int flag)
{
	rader(n,x);
	for(int len=2;len<=n;len<<=1)
	{
		cp omega_n(cos(flag*2*PI/len),sin(flag*2*PI/len));
		for(int i=0;i<n;i+=len)
		{
			cp omega(1,0);
			for(int j=i;j<i+(len>>1);++j)
			{
				cp t1=x[j],t2=omega*x[j+(len>>1)];
				x[j]=t1+t2;
				x[j+(len>>1)]=t1-t2;
				omega*=omega_n;
			}
		}
	}
	if(flag==-1)
		for(int i=0;i<n;++i)
			x[i]=int(round(x[i].real()/n));
	return;
}
int main()
{
	n=read();m=read();
	for(int i=0;i<=n;++i)x[i]=cp(read(),0);
	for(int i=0;i<=m;++i)y[i]=cp(read(),0);
	m+=n;n=1;
	while(n<=m)n<<=1;
	FFT(n,x,1);
	FFT(n,y,1);
	for(int i=0;i<n;++i)x[i]=x[i]*y[i];
	FFT(n,x,-1);
	for(int i=0;i<=m;++i)printf("%d ",(int)x[i].real());
	puts("");
	return 0;
}
